//
// Created by cen on 2025/8/16.
//

#include<thread>
#include <iostream>
#include <mutex>

using namespace std;

mutex m;

int main() {
    cout << "== 线程库测试 ==" << endl;
    thread t1([](int x) -> void {
        m.lock();
        for (int i = 0; i < x; i++) {
            cout << "*" << " ";
        }
        m.unlock();
    }, 10000);
    thread t2([](int x) -> void {
        m.lock();
        for (int i = 0; i < x; i++) {
            cout << "@" << " ";
        }
        m.unlock();
    }, 10000);

    cout << t1.get_id() << " " << t2.get_id() << endl;
    t1.join();
    t2.join();
    return 0;
}